#ifndef EC20_H
#define EC20_H

#define RDY_Str_Len             7
#define OK_Str_Len              6
#define CONNECT_Str_Len         11
#define QISEND_Str_Len          13
#define QICLOSE_Str_Len         14
#define CSQ_Str_Len             8

#define EC20_NOT_SeriaNet       0
#define EC20_SeriaNet           2

extern char array_QICLOSE[QICLOSE_Str_Len];
extern char array_CSQ[CSQ_Str_Len];

typedef struct
{
    unsigned char buf[1280];
    unsigned int  len;
    unsigned char signal_strength_value;
    unsigned char get_signal_step;
}__attribute__((packed, aligned(1))) EC20;

extern char ec20_connect_sendbuf[56];
unsigned char get_ec20_signal_value( char *buf, unsigned short pos );
void ec20_connect_data_package( unsigned char *ip, unsigned short port,unsigned char mode, char *out_str );
void EC20_recv_package_callback( unsigned char *data, unsigned short size );
void recv_EC20_package_handle( void );
void EC20_send_str( char *str );
void get_ec20_signal_strength( void );
void EC20_send_data( unsigned char *data, unsigned short size );
void EC20_connection_establishment( void );
#endif